package com.tutu.commons.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.tutu.commons.checks.UserLogin;
import com.tutu.commons.checks.UserRegister;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

/**
 * @Program: b2c-cloud-store
 * @Description: 用户实体类
 * @Author: JK.TuTu
 * @Version: 1.0
 * @Create: 2022-12-13 19:33
 **/
@Data
@TableName("user")
public class User implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    @JsonProperty("user_id")
    @TableField("user_id")
    private Integer userId; //用户id

    @NotBlank(message = "用户名不可为空",groups = {UserRegister.class, UserLogin.class})
    @TableField("user_name")
    private String userName; //用户名 唯一

    @JsonInclude(JsonInclude.Include.NON_NULL)  //字段为空的话 则不进行序列化
    @NotBlank(message="密码不可为空!",groups = {UserRegister.class, UserLogin.class})
    private String password; //密码

    @TableField("user_phonenumber")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @NotBlank(message = "用户电话不可为空!",groups = {UserRegister.class})
    private String userPhoneNumber; //用户手机号码

}
